export default {
  // 监听钩子
  hooks: {
    'render:route': (url, result) => {
      return result.html = result.html.replace(new RegExp(/data-n-head=\"ssr\" /, 'gi'), '');
    }
  },
  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: '✖✖✖✖✖✖✖✖✖✖',
    htmlAttrs: {
      lang: 'zh-CN'
    },
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { name: 'format-detection', content: 'telephone=no' }
    ],
    link: [{
      rel: 'icon',
      type: 'image/x-icon',
      href: '/favicon.ico'
    },
    {
      rel: 'stylesheet',
      href: '/css/element-ui.css'
    },
    {
      rel: 'stylesheet',
      href: '/css/styles.css'
    },
    {
      rel: 'stylesheet',
      href: '/css/mfgjw.css'
    },
    {
      rel: 'stylesheet',
      href: '/css/lpxq/lpxq.css'
    }
    ],
    script: [{
      src: "https://api.map.baidu.com/api?type=webgl&v=2.0&ak=QD1alOi5Col7B5UU8ad6twt4tU2MEFRi"
    },
    // {
    //   innerHTML: "var _hmt = _hmt || [];(function() {var hm = document.createElement(`script`);hm.src = `https://hm.baidu.com/hm.js?a6ed3174f23559dd4a4fb9d9cc445850`;var s = document.getElementsByTagName(`script`)[0];s.parentNode.insertBefore(hm, s);})();",
    //   type: 'text/javascript',
    //   charset: 'utf-8',
    // },
    // {
    //   innerHTML: "var _hmt = _hmt || [];(function() {var hm = document.createElement(`script`);hm.src = `https://hm.baidu.com/hm.js?bbfee2b1115946c74d98def512f42847`;var s = document.getElementsByTagName(`script`)[0];s.parentNode.insertBefore(hm, s);})();",
    //   type: 'text/javascript',
    //   charset: 'utf-8',
    // },
    // {
    //   innerHTML: "var _hmt = _hmt || [];(function() {var hm = document.createElement(`script`);hm.src = `https://hm.baidu.com/hm.js?7b1d0b2fec6432db4fb7bcc66c28fa81`;var s = document.getElementsByTagName(`script`)[0];s.parentNode.insertBefore(hm, s);})();",
    //   type: 'text/javascript',
    //   charset: 'utf-8',
    // },
    // {
    //   innerHTML: "window._agl = window._agl || [];(function () {_agl.push([`production`, `_f7L2XwGXjyszb4d1e2oxPybgD`]);(function () {var agl = document.createElement(`script`);agl.type = `text/javascript`;agl.async = true;agl.src = `https://fxgate.baidu.com/angelia/fcagl.js?production=_f7L2XwGXjyszb4d1e2oxPybgD`;var s = document.getElementsByTagName(`script`)[0];s.parentNode.insertBefore(agl, s);})();})();",
    //   type: 'text/javascript',
    //   charset: 'utf-8',
    // },
    {
      src: '/js/xf.js'
    }],
  },

  // Global CSS: https://go.nuxtjs.dev/config-css 
  // 'element-ui/lib/theme-chalk/index.css',
  // 'swiper/dist/css/swiper.css'
  css: [],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    '@/plugins/element-ui',
    {
      src: "~plugins/map.js",
      ssr: false
    },
    {
      src: "~/plugins/swiper.js",
      ssr: false
    },
  ],

  // Global call Middleware
  router: {
    middleware: 'auth'
  },

  // Auto import components: https://go.nuxtjs.dev/config-components
  components: true,

  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [],

  // Modules: https://go.nuxtjs.dev/config-modules 代理
  modules: [
    '@nuxtjs/axios', '@nuxtjs/proxy'
  ],

  axios: {
    proxy: true, // 表示开启代理
    prefix: '/', // 表示给请求url加个前缀 /api
    credentials: false // 表示跨域请求时是否需要使用凭证
  },

  proxy: {
    '/api': {
      target: 'http://fs.test.chuanxinwen.com',
      changeOrigin: true, // 表示是否跨域
      pathRewrite: {
        '^/api': '/', // 把 /api 替换成 /
      }
    }
  },

  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    transpile: [/^element-ui/],
    vendor: ['axios', 'element-ui', 'swiper']
  }
}
